fix: allow partial classes prop in withStyles#1428
Merged
kof merged 1 commit intocssinjs:masterfrom Feb 15, 2021
Merged
Conversation
The `classes` prop created by the `withStyles` function is meant to be an optional parameter where you can provide some or all of the style classes.
Contributor
Author
|
As a side note, I tried following all of the steps in CONTRIBUTING.md, but several of the steps don't seem to work anymore. There's no item in |
Member
|
makes sense to me |
Member
|
merged, thanks |
Member
|
Released in v10.6.0 |
This was referenced Mar 15, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
classesprop created by thewithStylesfunction is meant to be an optional parameter where you can provide some or all of the style classes.Imagine a somewhat contrived snippet like:
You'd expect to be able to use it in any of the following ways:
The last use case was broken in TypeScript because, while
classeswas an optional prop, each key within class was required. So you'd get an error like:This changes makes sure that the
classesproperty is still optional, but that each key within it is optional, too. I abstracted a field out so that I could use it in two places. There's probably about a dozen ways to set something like this up, though, so if you'd prefer it formatted in a different way let me know.